local zcdiy_yaoming = fk.CreateSkill {
    name = "zcdiy_yaoming",
}

Fk:loadTranslationTable {
    ["zcdiy_yaoming"] = "邀名",
    [":zcdiy_yaoming"] = "当你受到或造成伤害后，你可以令一名其他角色摸或弃置一张牌，若你与其手牌数相同，你可以重复此效果。",

    ["$zcdiy_yaoming1"] = "这，与你与我都是有利之事！",
    ["$zcdiy_yaoming2"] = "赈济百姓，何愁民心不归？",
}
local spec = {
    anim_type = "masochism",
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(zcdiy_yaoming.name)
    end,
    on_cost = function(self, event, target, player, data)
        local room = player.room
        local to = room:askToChoosePlayers(player, {
            min_num = 1,
            max_num = 1,
            targets = room:getOtherPlayers(player),
            skill_name = zcdiy_yaoming.name,
            prompt = "邀名：你可以令一名其他角色弃牌或摸牌",
            cancelable = true,
        })
        if #to > 0 then
            event:setCostData(self, { tos = to })
            return true
        end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local to = event:getCostData(self).tos[1]
        if #to:getCardIds("he") == 0 then
            to:drawCards(1, zcdiy_yaoming.name)
        else
            if room:askToSkillInvoke(player, { skill_name = zcdiy_yaoming.name, prompt = "邀名：点击确定令其摸一张牌，点击取消令其弃置一张牌" }) then
                to:drawCards(1, zcdiy_yaoming.name)
            else
                room:askToDiscard(to, {
                    min_num = 1,
                    max_num = 1,
                    include_equip = true,
                    skill_name = to.name,
                    cancelable = false,
                })
            end
        end
        while to:getHandcardNum() == player:getHandcardNum() do
            to = room:askToChoosePlayers(player, {
                min_num = 1,
                max_num = 1,
                targets = room:getOtherPlayers(player),
                skill_name = zcdiy_yaoming.name,
                prompt = "邀名：你可以令一名其他角色弃牌或摸牌",
                cancelable = true,
            })[1]
            if #to:getCardIds("he") == 0 then
                to:drawCards(1, zcdiy_yaoming.name)
            else
                if room:askToSkillInvoke(player, { skill_name = zcdiy_yaoming.name, prompt = "邀名：点击确定令其摸一张牌，点击取消令其弃置一张牌" }) then
                    to:drawCards(1, zcdiy_yaoming.name)
                else
                    room:askToDiscard(to, {
                        min_num = 1,
                        max_num = 1,
                        include_equip = true,
                        skill_name = to.name,
                        cancelable = false,
                    })
                end
            end
        end
    end,
}
zcdiy_yaoming:addEffect(fk.Damage, spec)
zcdiy_yaoming:addEffect(fk.Damaged, spec)


return zcdiy_yaoming
